DodoRunner.ObstacleGenerator = (function($, _, app, easel){
var
    canCircle = true,
    canSpike = true,
    canRect = true,

    init = function(){
        initKeyEvents();
    },

    initKeyEvents = function(){
        app.GameController.on("keyPress", function(event, charCode){
            switch (charCode) {
                case 106 : {
                    if(canRect){
                        app.Obstacle.createFallingBlock();
                        soundManager.play("shoot");
                        canRect = !canRect;
                        $("#rect").addClass("disabled");
                        setTimeout(function(){
                            canRect = true;
                            $("#rect").removeClass("disabled");
                        }, 500 + Math.random()*1000);
                    }
                } break;
                case 107 : {
                    if(canCircle){
                        app.Obstacle.createSphere();
                        soundManager.play("pony");
                        canCircle = !canCircle;
                        $("#ball").addClass("disabled");
                        setTimeout(function(){
                            $("#ball").removeClass("disabled");
                            canCircle = true;
                        }, 1500 + Math.random()*1000);
                    }
                } break;
                case 108 : {
                    if(canSpike){
                        canSpike = !canSpike;
                        soundManager.play("shoot");
                        $("#spike").addClass("disabled");
                        setTimeout(function(){
                            $("#spike").removeClass("disabled");
                            canSpike = true;
                        }, 500 + Math.random()*500);
                        app.Obstacle.createSpikes();
                    }
                } break;
            }
        });
    }

    return {
        init : init
    };

}(jQuery, _, DodoRunner, createjs));